<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String actId = request.getParameter("actId");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>组织活动页面</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/external/jquery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-validation-1.13.1/dist/jquery.validate.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>CSS/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-validation-1.13.1/demo/css/screen.css">
  </head>
  
  <body>
  		<div id="head-search">
   	 		<i class="home-path"></i>
   	 		<span class="path-font">活动管理&nbsp;&nbsp;>>&nbsp;&nbsp;组织活动&nbsp;&nbsp;>>&nbsp;&nbsp;活动内容</span>
   		</div>
  		<div class="mainbody" id="actlist"></div>
   
  </body>
  <script>
  $(function(){
		var id = "<%=actId%>";
	 //请求组织活动
	  $.ajax({
		  url:'<%=basePath%>getActByIDAction',
		  type:'get',
		  timeout:1000,
		  typeData:'json',
		  data:{'actId':id},
		  beforeSend:beforeFun,
		  error:errorFun,
		  success:sucFun	  
	  });
  });
  function beforeFun(){}
  function errorFun(){}
  //请求返回组织活动成功函数
  function sucFun(datas){
	 // alert(datas);
	 var json = eval("("+datas+")");
	//展示信息
	     
		 var actId = json.activityId,
		 	 actCount = json.attendCount,
		 	phone = json.contactPhone,
		 	addr = json.activityAddr,
		 	content = json.activityContent,
		 	date = json.activityDate,
		 	contacter = json.activityContacter,
		 	fucus = json.fucus,
		 	theme = json.activityTheme,
		 	actId = json.activityId;
		 	$("#actlist").html( $("#actlist").html()+"<div class='divrow'> <span style='font-size:20px;'>"+theme+
		 					"</span><br>内容："+content+
		 					"<br>时间："+date+
		 					"<br>地点："+addr+
		 					"<br>发布人："+contacter+
		 					"<br>联系电话："+phone+
		 				//	"<br>关注人数：<button>"+fucus+
		 					"<span class='span'>参加人数：<button id='actid"+actId+"' onclick='attend("+actId+")' mouseenter='enter("+actId+")' mouseleave='leave("+actId+")' title='点击参与此活动'>"+actCount+"</button></span>"+
		 					"</div>");
		
	
	
  }
 
  //点击按钮参与活动
  function attend(actId){	
	  $.ajax({
		  url:'<%=basePath %>attendAction',
		  type:'get',
		  timeout:1000,
		  typeData:'json',
		  data:{'actId':actId},
		  beforeSend:beforeFun,
		  error:errorFun,
		  success:function(data){		
			  		var json = eval("("+data+")");
			  		var isattend = json.isattend;
			  		var a = $("#actid"+actId).text();
			  		if(isattend==false || isattend =='false'){
			  		 $("#actid"+actId).text(parseInt(a)+1);
			  		 }else{
			  			 alert("您已参加了此活动！");
			  		 }
		  		}	  
	  });
	  
	  
  } 
  </script>
</html>
